﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Alogient.Cameleon.Sdk;
using Alogient.Cameleon.Sdk.Items;

namespace Alogient.Cameleon.Sdk.tests
{
    [TestFixture]
    public class CMPageCollectionTest : FixtureBase
    {
        [SetUp]
        public void Init()
        {
        }

        [TearDown]
        public void Finish()
        {
        }

        protected CMPageCollection CreateCollection()
        {
            var cultureCode = "fr-CA";
            var pages = new CMPageCollection();

            pages.Add(this.LoadPage(this.navID, cultureCode));
            // pages.Add(this.LoadPage(2, cultureCode));
            // pages.Add(this.LoadPage(3, cultureCode));

            return pages;
        }

        protected CMPage LoadPage(int navId, string cultureCode)
        {
            return new CMPage(navId, cultureCode);
        }

        [Test]
        public void GetPage()
        {
            var pages = this.CreateCollection();

            var navId = this.navID;
            var page = pages.GetPage(navId);

            Assert.AreEqual(navId, page.NavID);
        }

        [Test]
        public void GetPage2()
        {
            var pages = this.CreateCollection();

            var page = pages.GetPage(-1);

            Assert.IsNull(page);
        }

        [Test]
        public void Exists()
        {
            var pages = this.CreateCollection();

            Assert.IsTrue(pages.Exists(this.navID));

            Assert.IsFalse(pages.Exists(-1));
        }
    }
}
